<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/commons/pages/taglibs.jsp" %>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${naviString}</title>
<link href="${ctx}/commons/styles/themes/blue/styles/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/commons/scripts/jquery-ui/themes/redmond/jquery-ui.custom.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
  <div align="left" style="width:99%">
    <div align="left" class="nav">${naviString}</div>
    <html-el:form action="/manager/DeptInfo.do" enctype="multipart/form-data">
      <html-el:hidden property="method" value="save" />
      <html-el:hidden property="mod_id" />
      <html-el:hidden property="dept_id" />
      <html-el:hidden property="queryString" />
      <br />
      <table width="100%" border="0" align="left" cellpadding="1" cellspacing="1" class="datagrid">
        <tr>
          <th colspan="2">部门信息</th>
        </tr>
        <tr>
          <td width="15%" class="title_item"><span style="color: #F00;">*</span><strong>部门名称：</strong></td>
          <td width="85%"><html-el:text property="dept_name" styleId="dept_name" style="width:280px" /></td>
        </tr>
        <tr>
          <td class="title_item"><strong>部门负责人：</strong></td>
          <td><html-el:text property="dept_master_name" styleId="dept_master_name" style="width:60px;text-align:center;cursor:pointer;" title="请选择负责人" onfocus="this.blur()" readonly="true" />&nbsp;
          	<html-el:button property="choose_user" styleId="choose_user" value="请选择负责人" style="width:100px;cursor:pointer;" styleClass="ui-state-default ui-corner-all" />
            <html-el:hidden property="dept_master_id" styleId="dept_master_id" /></td>
        </tr>
        <tr>
          <td class="title_item"><strong>部门简介：</strong></td>
          <td><html-el:textarea property="dept_desc" styleId="dept_desc" style="width:400px" /></td>
        </tr>
        <tr>
          <td class="title_item"><strong>部门电话：</strong></td>
          <td><html-el:text property="dept_tel" styleId="dept_tel" style="width:160px" /></td>
        </tr>
        <tr>
          <td class="title_item"><strong>部门传真：</strong></td>
          <td><html-el:text property="dept_fax" styleId="dept_fax" style="width:160px" /></td>
        </tr>
        <tr>
          <td class="title_item"><span style="color: #F00;">*</span><strong>排序值：</strong></td>
          <td><html-el:text property="order_value" styleId="order_value" size="4" maxlength="4" />
            值越大，显示越靠前，范围：0-9999</td>
        </tr>
        <tr>
          <td class="title_item">&nbsp;</td>
          <td><html-el:button property="save" value=" 保 存 " styleId="save" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
            &nbsp;
            <html-el:reset value=" 重 填 " styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
            &nbsp;
            <html-el:button property="back" value=" 返 回 " onclick="history.back();" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
            &nbsp;&nbsp; <span id="loading" style="display:none;"><img src="${ctx}/commons/styles/images/loading.gif" style="vertical-align:middle; margin: 2px;" />数据提交中，请稍候...</span></td>
        </tr>
      </table>
    </html-el:form>
  </div>
</div>
<script type="text/javascript" src="${ctx}/commons/scripts/validator.js"></script>
<script type="text/javascript" src="${ctx}/commons/scripts/jquery.js"></script>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
	initStyle();
	
	$("#dept_name").attr("datatype","Require").attr("msg","部门名称必须填写");
	$("#order_value").focus(setOnlyNum).attr("datatype","Integer").attr("msg","排序值必须为整数");
		
	var f = document.forms[0];
	$("#save").click(function(){
		if(Validator.Validate(f, 1)) {
			$("#loading").show();
			$("#save").attr("disabled", "true");
			$("#reset").attr("disabled", "true");

			f.submit();
		}
	});
});

function initStyle(){
	$("input[type='text']").css({border: "1px solid #ccc"});
	$("input[type='submit'],input[type='reset'],input[type='button']").css({border: "1px solid"});
	$("input[type='text'][readonly],input[type='password'][readonly],textarea[readonly]").css({color:"#000"});
    $("input[type='text'],input[type='password'],textarea").not("[readonly]").focus(function(){
    	$(this).addClass("row_focus");
    }).blur(function(){
    	$(this).removeClass("row_focus");
    });
    
	$("textarea").each(function(){
		this.onpropertychange = function () {
			if (this.scrollHeight > 16) this.style.posHeight = this.scrollHeight;
		};
	});
}

function setOnlyNum() {
	$(this).css("ime-mode", "disabled").attr("t_value", "").attr("o_value", "").bind("dragenter",function(){
		return false;
	});
	$(this).keypress(function (){
		if(!this.value.match(/^[\+\-]?\d*?\.?\d*?$/))this.value=this.t_value;else this.t_value=this.value;if(this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=this.value;
	}).keyup(function (){
		if(!this.value.match(/^[\+\-]?\d*?\.?\d*?$/))this.value=this.t_value;else this.t_value=this.value;if(this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=this.value;
	}).blur(function (){
		if(!this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?|\.\d*?)?$/))this.value=this.o_value;else{if(this.value.match(/^\.\d+$/))this.value=0+this.value;if(this.value.match(/^\.$/))this.value=0;this.o_value=this.value;}
		if(this.value.length == 0) this.value = "0";
	});
	//this.text.selected;
}

$("#choose_user,#dept_master_name").click(function(){
	var returnValue = window.showModalDialog("StaffWord.do?method=chooseUser",window,"dialogWidth:700px;scroll:no;dialogHeight:500px");
	if(returnValue != null) {
		var value = new Array();
		value = returnValue.split(",");
        $("#dept_master_id").val(value[0]);
        $("#dept_master_name").val(value[1]);
    } 
});

//]]></script>
</body>
</html>
